<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal"
	scope="page" />

<c:if test="${param.multiple}">
	<c:choose>
		<c:when test="${target eq 'search'}">
			<c:choose>
				<c:when test="${region}">
					<div class="form-group ms-form-group">
						<label class="col-xs-2 control-label">选择公司：</label>
						<div class="col-xs-8">
							<select class="select2 multiple form-control"
								name="organizationIds" multiple tabindex="1"
								data-validate="required">
								<option></option>
								<c:forEach items="${orgIds}" var="orgId">
									<option value="${orgId}" selected>${persist.organization(orgId).name}</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</c:when>
				<c:otherwise>
					<div class="form-group ms-form-group">
						<label class="col-xs-2 control-label">公司：</label> <label
							class="col-xs-3 control-label" style="text-align: left;">
							<span>${persist.organization(orgIds).name}</span> <input
							type="hidden" name="organizationIds" value="${orgIds}" />
						</label>
					</div>
				</c:otherwise>
			</c:choose>
		</c:when>
		<c:otherwise>
			<c:choose>
				<c:when test="${region}">
					<div class="form-group ms-form-group">
						<label class="col-xs-2 control-label">选择公司：</label>
						<div class="col-xs-3">
							<select class="select2 form-control" name="organizationIds"
								tabindex="1" data-validate="required">
								<option></option>
								<c:forEach items="${orgIds}" var="orgId">
									<option value="${orgId}">${persist.organization(orgId).name}</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</c:when>
				<c:otherwise>
					<div class="form-group ms-form-group">
						<label class="col-xs-2 control-label">公司：</label> <label
							class="col-xs-3 control-label" style="text-align: left;">
							<span>${persist.organization(orgIds).name}</span> <input
							type="hidden" name="organizationIds" value="${orgIds}" />
						</label>
					</div>
				</c:otherwise>
			</c:choose>
		</c:otherwise>
	</c:choose>
</c:if>

<c:if test="${not param.multiple}">
	<c:choose>
		<c:when test="${region}">
			<label class="col-xs-2 control-label">选择公司：</label>
			<div class="col-xs-3">
				<select class="select2 form-control" name="organizationId"
					tabindex="1">
					<option></option>
					<c:forEach items="${orgIds}" var="orgId">
						<option value="${orgId}">${persist.organization(orgId).name}</option>
					</c:forEach>
				</select>
			</div>
		</c:when>
		<c:otherwise>
			<label class="col-xs-2 control-label">公司：</label>
			<label class="col-xs-3 control-label" style="text-align: left;">
				<span>${persist.organization(orgIds).name}</span> <input
				type="hidden" name="organizationId" value="${orgIds}" />
			</label>
		</c:otherwise>
	</c:choose>
</c:if>
